package SquarePackage;

import java.util.Random;

/**
 * An enum-class containing the six specified directions.
 * 
 * @author      Florian Hendrickx
 * @version		2.0
 */
public enum Direction {
	
	NORTH{
		public char getSymbol(){
			return 'N';
		}

		@Override
		public Direction getOpposite() {
			return Direction.SOUTH;
		}
	},
	EAST{
		public char getSymbol(){
			return 'E';
		}

		@Override
		public Direction getOpposite() {
			return Direction.WEST;
		}
	},
	SOUTH{
		public char getSymbol(){
			return 'S';
		}

		@Override
		public Direction getOpposite() {
			return Direction.NORTH;
		}
	},
	WEST{
		public char getSymbol(){
			return 'W';
		}

		@Override
		public Direction getOpposite() {
			return Direction.EAST;
		}
	},
	CEILING{
		public char getSymbol(){
			return 'C';
		}

		@Override
		public Direction getOpposite() {
			return Direction.FLOOR;
		}
	},
	FLOOR{
		public char getSymbol(){
			return 'F';
		}

		@Override
		public Direction getOpposite() {
			return Direction.CEILING;
		}
	};
	public abstract char getSymbol();
	public abstract Direction getOpposite();
	/**
	 * method returns a random Direction
	 * @return	random Direction (East,west,north,south,ceiling or floor)
	 */
	public static Direction getRandomDirection(){
		Random random = new Random();
		int randomNumber= random.nextInt(5);
		for(Direction direction : Direction.values()){
			if(direction.ordinal()==randomNumber){
				return direction;
			}
		}
		return null;
	}
}

